#include "myDlg.h"
#include "commonlog.h"
#include "DlgTemplate.h"

/********************
*	myDlg am;
	am.CreateModeDlg(_T("ttt"), CRect(0, 0, 100, 100), TRUE, this);
	am.DoModal();
	DoModal()有返回值，可以处理一下

	对用非模态对话框
	就是bMode改为false
	显示就是am.ShowWindow(SW_SHOW);
*********************/ 
 
myDlg::myDlg()
{
	m_hIcon = AfxGetApp()->LoadStandardIcon(IDI_APPLICATION);
}
myDlg::~myDlg()
{
}
void myDlg::DoDataExchange(CDataExchange* pDX)
{
}
 
BOOL myDlg::CreateModeDlg(CString strCaption, CRect rect, BOOL bMode, CWnd* pParent)
{
	BOOL bResult = FALSE;
	DLGTEMPLATE* pTemp = NULL;
	pTemp = m_dlgTemp.CreateTemplate(WS_POPUPWINDOW | DS_MODALFRAME | WS_CAPTION, rect, strCaption);
	if (bMode)
	{
		bResult = InitModalIndirect(pTemp, pParent);
	}
	else
	{
		bResult = CreateIndirect(pTemp, pParent);
	}
	return bResult;
}
BOOL myDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	if (m_hIcon)
	{
		SetIcon(m_hIcon, TRUE);   // 设置大图标
		SetIcon(m_hIcon, FALSE);  // 设置小图标
	}
 
	return TRUE;
}
 
 
void myDlg::OnOK()
{
	CDialog::OnOK();
}